<template>
	<view>
		<view style="text-align:center;padding:30rpx;padding-top:50rpx;padding-bottom:0rpx;">
			<view style="font-size:50rpx;">邀请人奖励</view>
			<view style="font-size:50rpx;">每邀请一位好友奖励5金币</view>
			<view style="padding:30rpx;">
				<button class="inviteBtn" open-type="share">立即邀请</button>
			</view>
		</view>

		<view style="padding:30rpx;padding-top:10rpx;">
			<view style="padding:30rpx; text-align: center; color:#FF6600;font-size:30rpx;">我的邀请：已成功邀请 <text
					style="color:#FF0000">{{ inviteList.length }}</text> 人，获得奖励 {{ TotalJiangli }}</view>
			<view style="width: 100%;">
				<!-- <view v-for="(item,index) in inviteList" :key="index">
					<view style="padding:30rpx;border-bottom:1rpx solid #f0f0f0" class="flexbc">
						<view style="width:40%">{{ item.NickName }}</view>
						<view>
							<view v-for="(itm, idx) in item.Wallet">
								{{ itm.WalletTitle }}：已奖励 <text style="color:#FF0000">{{ itm.WalletMoney }}</text> 金币
							</view>
						</view>
					</view>
				</view> -->

				<uni-table ref="table" :loading="loading" :border="false" stripe emptyText="暂无更多数据">
					<uni-tr>
						<uni-th align="center">邀请成员</uni-th>
						<uni-th align="center">邀请成功</uni-th>
						<uni-th align="center">加入会员</uni-th>
						<uni-th align="center">加入VIP</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in inviteList" :key="index">
						<uni-td align="center">
							<view class="name">{{ item.NickName }}</view>
						</uni-td>
						<uni-td align="center">
							<view class="name">奖励{{ item.jiangli.register }}金币</view>
						</uni-td>
						<uni-td align="center">
							<view class="name">奖励{{ item.jiangli.member }}金币</view>
						</uni-td>
						<uni-td align="center">
							<view class="name">奖励{{ item.jiangli.vip }}金币</view>
						</uni-td>
					</uni-tr>
				</uni-table>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				inviteUser: {},
				inviteList: [],
				TotalJiangli: 0
			}
		},
		onLoad() {

			this.getInviteList();
		},
		onShareAppMessage({
			from,
			target
		}) {

			let userinfo = this.inviteUser.NickName;

			let myObj = {
				title: `${userinfo}邀请您入驻！`,
				path: "/pages/index/index?inviter=" + this.inviteUser.UserID,
				imageUrl: "https://api.meimo.comdns.cn/public/commshare.jpg"
			}
			return myObj;
		},
		methods: {
			getInviteList() {
				this.$httpost('/UserCenter/InviteList', {}).then(res => {
					// console.log('接口返回数据：', res);
					if (res.code == 200) {
						this.inviteUser = res.data.InviteUser
						this.inviteList = res.data.InviteList
						this.TotalJiangli = res.data.TotalJiangli
						// console.log(this.inviteUser.NickName)
					}
				})

			},
			inviteHandle() {
				// 分享邀请

				// this.$httpost('/UserAction/Invite', {}).then(res => {
				// 	// console.log('Invite：', res);
				// 	if (res.code == 200) {
				// 		this.inviteUser = res.data.InviteUser
				// 		this.inviteList = res.data.InviteList

				// 		// console.log(this.inviteUser.NickName)
				// 	}
				// })
			}
		}
	}
</script>

<style lang="scss" scoped>
	.inviteBtn {
		background-color: $globalColor;
		font-size: 32rpx;
	}

	.name {
		font-size: 24rpx;
	}

	.uni-table {
		background-color: transparent !important;
	}
</style>